﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Login - KPIReport</title>
    <!-- Stylesheets -->
    <%--<link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet'>--%>
    <!-- Optimize for mobile devices -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="shortcut icon" href="images/favicon_favicon.png">
    <script src="scripts/jquery-1.9.0.min.js" type="text/javascript"></script>
    <script src="scripts/jquery-ui-1.9.2.custom.min.js" type="text/javascript"></script>
    <script src="scripts/jquery.sha1.js" type="text/javascript"></script>
    <link href="styles/newcss/stylelogin.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript">

    $(document).ready(function () {
        $('#btnMasuk').click(function () {

            var kode = $('#txtKode').val();
            var pwd = $('#txtPassword').val();
           
            var objUser = new Object();
            objUser.UserCode = encodeURIComponent(kode);

            if (typeof ($('#txtPassword').val()) != 'undefined')
                objUser.Password = encodeURIComponent($.sha1($('#txtPassword').val()));

            jsonData = JSON.stringify(objUser);

            $.ajax({
                type: 'POST',
                url: 'ajaxhandler/authentication/loginhandler.ashx',
                contentType: 'application/json',
                dataType: 'json',
                data: jsonData,
                success: function (data) {

                    if (data.IsValid == 'True') {

                        window.location = data.DefaultUrl;

                    }
                    else {
                        alert(data.Message);
                        //$.msgBox(data.Message, null, { title: "Pesan Error" });
                    }

                },
                error: function (response) {
                    var r = JSON.parse(response.responseText);
                    alert("Error Message: " + r.Message);
                    //$.msgBox("Error Message: " + r.Message, null, { title: "Pesan Error" });
                }
            });

            return false;

        });

    });

</script>
<body>
    <!-- TOP BAR -->
    <div id="top-bar">
        <div class="page-full-width">
            <%--  <a href="#" class="round button dark ic-left-arrow image-left ">Return to website</a>--%>
            &nbsp;
        </div>
        <!-- end full-width -->
    </div>
    <!-- end top-bar -->
    <!-- HEADER -->
    <div id="header">
        <div class="page-full-width cf">
            <div id="login-intro" class="fl">
                <h1>
                    Login to KPI Report</h1>
                <h5>
                    Enter your credentials below</h5>
            </div>
            <!-- login-intro -->
            <!-- Change this image to your own company's logo -->
            <!-- The logo will automatically be resized to 39px height. -->
            <a href="#" id="company-branding" class="fr">
                <img src="images/logo_nestle_2.png" alt="PT.Nestle" width="200" height="200" /></a>
        </div>
        <!-- end full-width -->
    </div>
    <!-- end header -->
    <!-- MAIN CONTENT -->
    <div id="content">
        <form action="#" method="POST" id="login-form">
        <fieldset>
            <p>
                <label for="login-username">
                    username</label>
                <input type="text" id="txtKode" class="round full-width-input" autofocus />
            </p>
            <p>
                <label for="login-password">
                    password</label>
                <input type="password" id="txtPassword" class="round full-width-input" />
            </p>
            <p>
                <br />
            </p>
             <input name="btnMasuk" style="color:White;" id="btnMasuk" type="submit" value="LOG IN" class="button round blue image-right ic-right-arrow" />
            <%--<a href="#" id="btnMasuk" class="button round blue image-right ic-right-arrow">LOG IN</a>--%>
        </fieldset>
        <br />
        <div>
        </div>
        </form>
    </div>
    <!-- end content -->
    <!-- FOOTER -->
    <div id="footer">
        <p>
            &copy; Copyright 2014 <a href="#">Nestle</a></p>
        <p>
            <%--<strong>SimpleAdmin</strong> theme by <a href="http://www.adipurdila.com">Adi Purdila</a>--%>
            All rights reserved
        </p>
    </div>
    <!-- end footer -->
</body>
</html>
